#include <iostream>

namespace YX 
{
    template<class Iterator,class Ref,class Ptr>
    class Reverse_Iterator 
    {
   
        typedef Reverse_Iterator<Iterator,Ref,Ptr> RI;

        private:
            Iterator _it;

        public:
            Reverse_Iterator(Iterator it)
                :_it(it)
            {

            }

            RI& operator++()
            {
                --_it;
                return *this;
            }

            RI operator++(int)
            {
                RI ret=*this;

                --_it;

                return ret;
            }

            RI& operator--()
            {
                ++_it;
                return *this;
            }

            RI operator--(int)
            {
                RI ret=*this;

                ++_it;

                return ret;
            }

            Ref operator*()
            {
                Iterator tmp=_it;

                --tmp;

                return *tmp;
            }

            Ptr operator->()
            {
                return &(operator*());
            }

            bool operator!=(RI rit)
            {
                return _it!=rit._it;
            }

            bool operator==(RI rit)
            {
                return _it==rit._it;
            }
    };



};
